(function (exports, $){ 'use strict'; if(!exports.Cookies){ console.error('WooCommerce Cookies Jar is not available.'); } var ZooProductsCompareModel=(function (){ function Constructor(){ if(null===window.localStorage.getItem(this.STORAGE_KEY)) window.localStorage.setItem(this.STORAGE_KEY, '[]'); } Object.defineProperty(Constructor.prototype, 'STORAGE_KEY', { value: 'zooProductsCompareItems', writable: false, enumerable: false, configurable: false }); Constructor.prototype.add=function (itemID){ var items=this.list(); itemID=parseInt(itemID, 10); if(-1===items.indexOf(itemID)){ items.push(itemID); var stringifiedItems=JSON.stringify(items); window.localStorage.setItem(this.STORAGE_KEY, stringifiedItems); Cookies.remove(this.STORAGE_KEY); Cookies.set(this.STORAGE_KEY, stringifiedItems); return true; }else{ return false; }} Constructor.prototype.exists=function (itemID){ var items=this.list(); if(-1!==items.indexOf(itemID)){ return true; }else{ return false; }} Constructor.prototype.remove=function (itemID){ var items=this.list(), itemIndex=items.indexOf(itemID); if(-1!==itemIndex){ items.splice(itemIndex, 1); var stringifiedItems=JSON.stringify(items); window.localStorage.setItem(this.STORAGE_KEY, stringifiedItems); Cookies.remove(this.STORAGE_KEY); Cookies.set(this.STORAGE_KEY, stringifiedItems); return true; } return false; } Constructor.prototype.list=function (){ return JSON.parse(window.localStorage.getItem(this.STORAGE_KEY)); }; Constructor.prototype.clear=function (){ window.localStorage.setItem(this.STORAGE_KEY, '[]'); Cookies.remove(this.STORAGE_KEY); }; return Constructor; }()); var ZooProductsCompareView=(function (){ function Constructor(){ this.panel=$('.products-compare-panel'); this.counter=$('.products-compare-counter'); this.addBtn='.add-to-products-compare'; this.removeBtn='.remove-from-products-compare'; this.browseBtn='.browse-products-compare:not(.redirect-link)'; if(!this.panel.length){ this.renderPanel(); this.panel=$('.products-compare-panel'); }} Constructor.prototype.renderPanel=function (content){ content = !!content ? content:'

' + zooProductsCompareCDATA.compareIsEmpty + '

'; if(this.panel.length){ this.panel.find('.products-compare-panel-inner').html(content); }else{ $('body').append(''); }} Constructor.prototype.renderAddButton=function (btn){ if(!btn instanceof jQuery) throw new TypeError('Factoring wishlist button is not an instance of jQuery.'); if(btn.hasClass('browse-products-compare')) btn.removeClass('browse-products-compare'); if(!btn.hasClass('add-to-products-compare')) btn.addClass('add-to-products-compare'); btn.attr('title', zooProductsCompareCDATA.addToCompare); btn.html(zooProductsCompareCDATA.addToCompareIcon + zooProductsCompareCDATA.addToCompare); } Constructor.prototype.renderBrowseButton=function (btn){ if(!btn instanceof jQuery) throw new TypeError('Factoring wishlist button is not an instance of jQuery.'); btn=$('.zoo-compare-button[data-id='+btn.data('id')+']'); btn.removeClass('add-to-products-compare'); btn.not('.browse-products-compare').addClass('browse-products-compare'); btn.attr('title', zooProductsCompareCDATA.browseCompare); btn.html(zooProductsCompareCDATA.browseCompareIcon + zooProductsCompareCDATA.browseCompare); } return Constructor; }()); var ZooProductsCompareController=(function (){ function Constructor(model, view){ this.view=view; this.model=model; this.doingAJAX=false; var itemsCount=this.model.list().length; this.view.counter.text(itemsCount); if(itemsCount < 1){ this.view.counter.addClass('zoo-hidden'); }else{ this.view.counter.removeClass('zoo-hidden'); } this.updateAddButtonsActions(); this.listen(); } Constructor.prototype.sync=function (changeEvent){ if('zooProductsCompareItems'===changeEvent.key){ var items=JSON.parse(window.localStorage.getItem('zooProductsCompareItems')); $('.products-compare-counter').text(items.length); if(items.length < 1){ $('.products-compare-counter').addClass('zoo-hidden'); }} }; Constructor.prototype.updateAddButtonsActions=function (){ var self=this, addedItems=this.model.list(); $(this.view.addBtn).each(function (index){ if(!this instanceof HTMLElement) return; var itemID=parseInt(this.dataset.id); if(-1!==addedItems.indexOf(itemID)) self.view.renderBrowseButton($(this)); }); }; Constructor.prototype.addAction=function (addEvent){ addEvent.preventDefault(); var target=$(addEvent.currentTarget), itemID=target.data('id'); if(target.hasClass('browse-products-compare')) return this.browseAction(addEvent); if(this.model.exists(itemID)){ this.view.renderBrowseButton(target); return; } if(this.model.add(itemID)){ this.view.renderBrowseButton(target); this.view.counter.removeClass('zoo-hidden'); this.view.counter.text(this.model.list().length); if(target.hasClass('redirect-link')){ if($(document).find('.zoo-product-popup-notice')[0]){ $(document).find('.zoo-product-popup-notice').addClass('active'); }else{ $('body').append('
'+target.data("label-added")+'
'); setTimeout(function (){ $(document).find('.zoo-product-popup-notice').addClass('active'); },100); } setTimeout(function (){ $(document).find('.zoo-product-popup-notice').removeClass('active'); },1200); }else{ return this.browseAction(addEvent); }}else{ alert(zooProductsCompareCDATA.addToCompareErr); }}; Constructor.prototype.removeAction=function (removeEvent){ removeEvent.preventDefault(); var itemID=$(removeEvent.currentTarget).data('id'), removed=this.model.remove(itemID); if(removed){ var itemsCount=this.model.list().length; if(itemsCount){ this.view.panel.find('.products-compare-row-' + itemID).remove(); }else{ this.view.renderPanel('

' + zooProductsCompareCDATA.compareIsEmpty + '

'); } this.view.counter.text(itemsCount); if(itemsCount < 1){ this.view.counter.addClass('zoo-hidden'); }} }; Constructor.prototype.browseAction=function (browseEvent){ browseEvent.preventDefault(); var self=this, items=this.model.list(); self.view.panel.fadeIn(); if(items.length&&!this.doingAJAX){ this.doingAJAX=true; $.ajax({ method: 'POST', url: ajaxurl, data: { action: 'zoo_get_compare_products', compareItems: JSON.stringify(items) }}).done(function (response){ self.doingAJAX=false; self.view.renderPanel(response.html); self.view.removeBtn='.remove-from-products-compare'; $(document).on('click', self.view.removeBtn, function(removeEvent){self.removeAction(removeEvent)}); self.view.panel.find('.zoo-popup-inner').fadeIn(); }); }else{ self.view.panel.find('.zoo-popup-inner').fadeIn() } $(document).trigger('zoo_browse_compare'); }; Constructor.prototype.listen=function (){ var $this=this; $(document).on('click', this.view.addBtn, function (addEvent){$this.addAction(addEvent)}); if($(this.view.removeBtn).length){ $(document).on('click', this.view.removeBtn, function(removeEvent){$this.removeAction(removeEvent)}); } $(document).on('click', this.view.browseBtn, function(browseEvent){$this.browseAction(browseEvent)}); this.view.panel.find('.products-compare-panel-close-btn').on('click', function(closeEvent){$this.view.panel.fadeOut()}); this.view.panel.find('.popup-mask-close').on('click', function(closeEvent){$this.view.panel.fadeOut()}); window.addEventListener('storage', this.sync); } return Constructor; }()); $(document).ready(function (){ exports.zooProductsCompare=new ZooProductsCompareController(new ZooProductsCompareModel(), new ZooProductsCompareView()) }) }(window, jQuery)); (function ($, w){ "use strict"; $('.wrap-list-cat-search select').on('change', function (){ $(this).parent().find('span').text($(this).find("option:selected").text()); }); $("form.zoo-live-search").each(function (){ var inputtingTimer=null; var zooSearchForm=$(this), zooSearchFormInputField=$(this).find(".search-field"), zooSearchFormSelectField=$(".zoo-product-cat-options", zooSearchForm); zooSearchFormInputField.on("keypress", function (e){ if(e.which===13) e.preventDefault(); zoo_ajax_search(); }); zooSearchFormInputField.on("input", function (e){ zoo_ajax_search(); }); zooSearchFormSelectField.on('change', function (){ zoo_ajax_search(); }); function zoo_ajax_search(){ clearTimeout(inputtingTimer); inputtingTimer=setTimeout(function (){ var zooSearchFormInputFieldVal=zooSearchFormInputField.val(); if(zooSearchFormInputFieldVal.length >=3){ var queryData={ queryString: zooSearchFormInputFieldVal }; if(zooSearchFormSelectField.length){ queryData.productCat=zooSearchFormSelectField.val(); } zooSearchForm.addClass('searching'); var number_result=$('.zoo-search-form.header-search-form.zoo-live-search .search-field').attr('number-result'); $.ajax({ url: ajaxurl, type: "POST", data: { action: "zoo_get_live_search_results", searchQuery: JSON.stringify(queryData), number_result: number_result, }}).done(function (result){ if($('.wrap-search-result')[0]){ $('.wrap-search-result').replaceWith(result); }else{ zooSearchForm.append(result); } zooSearchForm.removeClass('searching'); }).fail(function (result){ zooSearchForm.removeClass('searching'); console.log(result); }); }else{ if($('.wrap-search-result')[0]){ $('.wrap-search-result').fadeOut(); }} }, 500); }}); $(document).on('click', function (){ if($('.wrap-search-result')[0]||!$(this).hasClass('zoo-live-search')){ $('.wrap-search-result').fadeOut(); }}); jQuery(function ($){ var current_width=0; $(window).resize(function (){ if(current_width!=$(window).width()){ current_width=$(window).width(); var window_w=$(window).width(); $('.pos-left').removeClass('pos-left'); $('.primary-menu .sub-menu, .primary-menu .dropdown-submenu, .primary-menu .cmm-sub-container, .element-top-menu .sub-menu').each(function (){ if(window_w < parseInt($(this).offset()['left'] + $(this).width())){ $(this).addClass('pos-left'); }}); $('.mask-off-canvas').removeClass('active'); $('.header-off-canvas-sidebar').removeClass('active'); }}).resize(); $(document).on('click', '.btn-lb-search', function (e){ e.preventDefault(); $('.wrap-lb-search').addClass('active'); setTimeout(function (){ $('.wrap-lb-search input').focus() }, 300) }); $(document).on('click', '.wrap-lb-search.active', function (e){ if(e.target!==this) return; else { $(this).removeClass('active') }}); $(document).on('click', '.btn-close-lb-search', function (e){ e.preventDefault(); $('.wrap-lb-search').removeClass('active'); }); $(document).on("keyup", function (e){ if(e.which===27){ $('.wrap-lb-search.active').removeClass('active'); $('.header-off-canvas-sidebar.active, .mask-off-canvas.active').removeClass('active') }}); $(document).on('click', '.off-canvas-toggle', function (e){ e.preventDefault(); var $target=$('.header-off-canvas-sidebar.show-on-mobile'); if($(this).closest('.wrap-site-header-desktop')[0]){ $target=$('.header-off-canvas-sidebar.show-on-desktop'); } if(!!$target.not('.off-canvas-dropdown')[0]){ $('.mask-off-canvas').toggleClass('active'); $target.toggleClass('active'); }else{ $target.slideToggle(); }}); $(document).on('click', '.off-canvas-close, .mask-off-canvas.active', function (e){ e.preventDefault(); $('.mask-off-canvas.active').removeClass('active'); $('.header-off-canvas-sidebar.active').removeClass('active'); }); $(document).on('click', '.element-header-account.off-canvas .account-element-link', function (e){ e.preventDefault(); $('.zoo-account-block.login-form-off-canvas').addClass('active'); }); $(document).on('click', '.zoo-account-block.login-form-off-canvas .overlay', function (e){ e.preventDefault(); $('.zoo-account-block.login-form-off-canvas').removeClass('active'); }); $(document).on('click', '.control-login-popup .account-element-link', function (e){ e.preventDefault(); $('.login-form-popup').toggleClass('active'); }); $(document).on('click', '.login-form-popup .overlay,.login-form-popup .close-login', function (e){ e.preventDefault(); $('.login-form-popup').removeClass('active'); }); $(document).on('click', '.element-cart-icon.off-canvas .element-cart-link', function (e){ e.preventDefault(); $('.wrap-element-cart-off-canvas').toggleClass('off-canvas-cart-active'); }); $(document).on('click', '.off-canvas-cart-active .mask-close,.off-canvas-cart-active .close-cart', function (e){ e.preventDefault(); $('.off-canvas-cart-active').removeClass('off-canvas-cart-active'); }); if(typeof Cookies!='undefined'){ if(Cookies.get('woocommerce_items_in_cart') > 0){ $('.element-cart-icon').removeClass('cart-empty'); }} $(document).on('added_to_cart', function (event, fragments){ $('.element-cart-icon.loading').removeClass('loading'); $('.wrap-element-cart-off-canvas.loading').removeClass('loading'); }); $(document).on('zoo_single_product_cart_added', function (event, response){ $('.element-cart-link').html($(response['response']).find('.element-cart-link').html()); $('.element-cart-icon.loading').removeClass('loading'); $('.wrap-element-cart-off-canvas.loading').removeClass('loading'); }); $(document).on('zoo_starting_add_to_cart', function (){ $('.wrap-element-cart-off-canvas').addClass('loading off-canvas-cart-active'); }); $(document).on('adding_to_cart', function (){ $('.wrap-element-cart-off-canvas').addClass('loading off-canvas-cart-active'); }); $(document).on('zoo_after_remove_product_item', function (event, response){ var fragments=response.fragments; $('.element-cart-icon .element-cart-count').html(fragments['cart_count']); $('.element-cart-icon .total-element-cart').html(fragments['cart_subtotal']); }); $(document).on('zoo_after_restore_product_item', function (event, response){ var fragments=response.fragments; $('.element-cart-icon .element-cart-count').html(fragments['cart_count']); $('.element-cart-icon .total-element-cart').html(fragments['cart_subtotal']); }); $(".header-off-canvas-sidebar .language-options").on('click', function (){ $(this).next().slideToggle(); }); $('.header-off-canvas-sidebar .list-languages').on('click', function (){ $(this).slideUp(); }); if(typeof $.fn.stick_in_parent){ var to_top=0, to_top_mobile; if($(window).width() > 600){ to_top=to_top_mobile = !!$('#wpadminbar')[0] ? $('#wpadminbar').height():0; } let current_width=0; $(window).resize(function (){ if(current_width!=$(window).width()){ current_width=$(window).width(); $('.site-header').height('auto'); $('.site-header').height($('.site-header').height()); }}).resize(); $('.site-header .sticker').each(function (){ var $this=$(this); var this_to_top=$this.closest('.wrap-site-header-desktop')[0] ? to_top:to_top_mobile; $this.data('to-top', this_to_top); if(!$this.hasClass('jump-down-animation')){ $this.stick_in_parent({bottoming:false, parent: 'body',spacer: false,sticky_class:'is-sticky', offset_top:this_to_top }).on("sticky_kit:unstick", function(e){ console.log("has unstuck!", e.target); }); } if(!!$this.data('sticky-height')){ this_to_top +=$this.data('sticky-height'); }else{ this_to_top +=$this.height(); } !!$this.closest('.wrap-site-header-desktop')[0] ? to_top=this_to_top:to_top_mobile=this_to_top; }); if($('.site-header .sticker.jump-down-animation')[0]){ $(window).on("scroll", function (){ $('.site-header .sticker.jump-down-animation').each(function (){ var $this=$(this); if($(window).scrollTop() > $('.site-header').height()&&!$this.parents('.is-sticky')[0]){ $this.stick_in_parent({bottoming:false,parent: 'body',sticky_class:'is-sticky',spacer: false,offset_top:$this.data('to-top')}); $this.addClass('deactive'); } if($(window).scrollTop() > parseInt($('.site-header').height() + 100)&&$this.hasClass('deactive')){ $this.removeClass('deactive'); } if($this.parents('.sticky-wrapper:not(.is-sticky)')[0]&&$(window).scrollTop() < $('.site-header').height()){ $this.trigger("sticky_kit:detach"); }}); }); } window.onscroll=function (e){ if($('html').scrollTop()==0&&window.navigator.userAgent.indexOf("Edge")=='-1'){ $(document.body).trigger("sticky_kit:recalc"); }} } $(document).on('click', '.wrap-content-header-off-canvas .menu-item .zoo-icon-down', function (e){ if(e.target!==this) return; else { e.preventDefault(); $(this).toggleClass('active'); $(this).closest('.menu-item').children('ul').slideToggle(); if(!$(this).hasClass('active')){ $(this).closest('.menu-item').find('ul').slideUp(); $(this).closest('.menu-item').find('.active').removeClass('active'); }} }); $('body').on('edd_cart_item_added', function(event, response){ $('.edd-cart').removeClass('empty'); $('.edd-cart-total').html(response.total); }); }); }(jQuery, window)); !function(e,o,t,n,i,r){function c(e,t){r?n(e,t||32):i.push(e,t)}function f(e,t,n,i){return t&&o.getElementById(t)||(i=o.createElement(e||'SCRIPT'),t&&(i.id=t),n&&(i.onload=n),o.head.appendChild(i)),i||{}}r=/p/.test(o.readyState),e.addEventListener('on'+t in e?t:'load',function(){for(r=t;i[0];)c(i.shift(),i.shift())}),c._=f,e.defer=c,e.deferscript=function(t,n,e,i){c(function(e){f(0,n,i).src=t},e)}}(this,document,'pageshow',setTimeout,[]),function(u,n){var a='IntersectionObserver',d='src',l='lazied',h='data-',p=h+l,y='load',m='forEach',r='appendChild',b='getAttribute',c=n.head,g=Function(),v=u.defer||g,f=v._||g;function I(e,t){return[].slice.call((t||n).querySelectorAll(e))}function e(s){return function(e,t,o,r,c,f){v(function(n,t){function i(n){!1!==(r||g).call(n,n)&&(I('SOURCE',n)[m](i),(f||['srcset',d,'style'])[m](function(e,t){(t=n[b](h+e))&&(n[e]=t)}),y in n&&n[y]()),n.className+=' '+(o||l)}t=a in u?(n=new u[a](function(e){e[m](function(e,t){e.isIntersecting&&(t=e.target)&&(n.unobserve(t),i(t))})},c)).observe.bind(n):i,I(e||s+'['+h+d+']:not(['+p+'])')[m](function(e){e[b](p)||(e.setAttribute(p,s),t(e))})},t)}}function t(){v(function(t,n,i,o){t=[].concat(I((i='script[type=deferjs]')+':not('+(o='[async]')+')'),I(i+o)),function e(){if(0!=t){for(o in n=f(),(i=t.shift()).parentNode.removeChild(i),i.removeAttribute('type'),i)'string'==typeof i[o]&&n[o]!=i[o]&&(n[o]=i[o]);n[d]&&!n.hasAttribute('async')?(n.onload=n.onerror=e,c[r](n)):(c[r](n),v(e,.1))}}()},4)}t(),u.deferstyle=function(t,n,e,i){v(function(e){(e=f('LINK',n,i)).rel='stylesheet',e.href=t},e)},u.deferimg=e('IMG'),u.deferiframe=e('IFRAME'),v.all=t}(this,document); (function(){var a,b;a=window.jQuery,b=a(window),a.fn.stick_in_parent=function(c){var d,e,f,g,h,j,k,l,m,n,o,p,q;for(null==c&&(c={}),q=c.sticky_class,j=c.inner_scrolling,p=c.recalc_every,o=c.parent,m=c.offset_top,l=c.spacer,f=c.bottoming,null==m&&(m=0),null==o&&(o=void 0),null==j&&(j=!0),null==q&&(q="is_stuck"),d=a(document),null==f&&(f=!0),n=function(a){var b,c,d;return window.getComputedStyle?(b=a[0],c=window.getComputedStyle(a[0]),d=parseFloat(c.getPropertyValue("width"))+parseFloat(c.getPropertyValue("margin-left"))+parseFloat(c.getPropertyValue("margin-right")),"border-box"!==c.getPropertyValue("box-sizing")&&(d+=parseFloat(c.getPropertyValue("border-left-width"))+parseFloat(c.getPropertyValue("border-right-width"))+parseFloat(c.getPropertyValue("padding-left"))+parseFloat(c.getPropertyValue("padding-right"))),d):a.outerWidth(!0)},g=function(c,e,g,h,i,k,r,s){var t,u,v,w,x,y,z,A,B,C,D,E;if(!c.data("sticky_kit")){if(c.data("sticky_kit",!0),x=d.height(),z=c.parent(),null!=o&&(z=z.closest(o)),!z.length)throw"failed to find stick parent";return(v=!1,t=!1,D=null==l?a("
"):l&&c.closest(l),D&&D.css("position",c.css("position")),A=function(){var a,b,f;if(!s&&(x=d.height(),a=parseInt(z.css("border-top-width"),10),b=parseInt(z.css("padding-top"),10),e=parseInt(z.css("padding-bottom"),10),g=z.offset().top+a+b,h=z.height(),v&&(v=!1,t=!1,null==l&&(c.insertAfter(D),D.detach()),c.css({position:"",top:"",width:"",bottom:""}).removeClass(q),f=!0),i=c.offset().top-(parseInt(c.css("margin-top"),10)||0)-m,i=0>i?0:i,k=c.outerHeight(!0),r=c.css("float"),D&&D.css({width:n(c),height:k,display:c.css("display"),"vertical-align":c.css("vertical-align"),float:r}),f))return E()},A(),k!==h)?(w=void 0,y=m,C=p,E=function(){var a,n,o,u,B,E;if(!s)return(o=!1,null!=C&&(C-=1,0>=C&&(C=p,A(),o=!0)),o||d.height()===x||(A(),o=!0),u=b.scrollTop(),null!=w&&(n=u-w),w=u,v?(f&&(B=u+k+y>h+g,t&&!B&&(t=!1,c.css({position:"fixed",bottom:"",top:y}).trigger("sticky_kit:unbottom"))),uE&&!t&&(y-=n,y=Math.max(E-k,y),y=Math.min(m,y),v&&c.css({top:y+"px"})))):u>i&&(v=!0,a={position:"fixed",top:y},a.width="border-box"===c.css("box-sizing")?c.outerWidth()+"px":c.width()+"px",c.css(a).addClass(q),null==l&&(c.after(D),("left"===r||"right"===r)&&D.append(c)),c.trigger("sticky_kit:stick")),v&&f&&(null==B&&(B=u+k+y>h+g),!t&&B))?(t=!0,"static"===z.css("position")&&z.css({position:"relative"}),c.css({position:"absolute",bottom:e,top:"auto"}).trigger("sticky_kit:bottom")):void 0},B=function(){return A(),E()},u=function(){if(s=!0,b.off("touchmove",E),b.off("scroll",E),b.off("resize",B),a(document.body).off("sticky_kit:recalc",B),c.off("sticky_kit:detach",u),c.removeData("sticky_kit"),c.css({position:"",bottom:"",top:"",width:""}),z.position("position",""),v)return null==l&&(("left"===r||"right"===r)&&c.insertAfter(D),D.remove()),c.removeClass(q)},b.on("touchmove",E),b.on("scroll",E),b.on("resize",B),a(document.body).on("sticky_kit:recalc",B),c.on("sticky_kit:detach",u),setTimeout(E,0)):void 0}},(h=0,k=this.length);h'; if($('.element-cart-icon:not(.off-canvas)')[0]||!$('.element-cart-icon')[0]) zoo_add_to_cart_mess($shopNotices); $('.widget_shopping_cart_content').html($response.find('.widget_shopping_cart_content').html()); $('.heading-element-cart-content .total-cart-item').html($response.find('.heading-element-cart-content .total-cart-item').html()); $this.addClass('cart-added'); $this.html(wc_add_to_cart_params.i18n_view_cart); $this.prepend(icon); }else{ window.location=$this.attr('direct_link'); return false; }} }); return false; }}); $(document).on('click', '.product .btn-quick-view', function (e){ e.preventDefault(); $('.zoo-mask-close').addClass('loading active mask-quick-view'); var load_product_id=$(this).attr('data-productid'); var data={action: 'zoo_quick_view', product_id: load_product_id}; $(this).parent().addClass('loading'); var $this=$(this); $.ajax({ url: ajaxurl, data: data, type: "POST", success: function (response){ $('body').append(response); $this.parent().removeClass('loading'); var form_variation=$(document).find('#zoo-quickview-lb .variations_form'); form_variation.wc_variation_form(); form_variation.trigger('check_variations'); zoo_quick_view_gal(); if($('#zoo-quickview-lb .zoo-wishlist-button')[0]){ if(window.zooWishlist.model.exists($('#zoo-quickview-lb .zoo-wishlist-button').data('id'))){ window.zooWishlist.view.renderBrowseButton($('#zoo-quickview-lb .zoo-wishlist-button')); }} if($('#zoo-quickview-lb .zoo-compare-button')[0]){ if(window.zooProductsCompare.model.exists($('#zoo-quickview-lb .zoo-compare-button').data('id'))){ window.zooProductsCompare.view.renderBrowseButton($('#zoo-quickview-lb .zoo-compare-button')); }} $('.lazy-img:not(.loaded)').zoo_lazyImg(); setTimeout(function (){ $('#zoo-quickview-lb').css('opacity', '1'); $('#zoo-quickview-lb').css('top', '50%'); }, 100); }}); }); $(document).on('click', '.close-quickview, .zoo-mask-close.mask-quick-view', function (e){ e.preventDefault(); zoo_close_quick_view(); }); $(document).on('zoo_browse_wishlist', function (){ zoo_close_quick_view(); }); $(document).on('zoo_browse_compare', function (){ zoo_close_quick_view(); }); $(document).on('cleverswatch_update_gallery', function (event, response){ if($('#zoo-quickview-lb')[0]) zoo_quick_view_gal(); }); function zoo_close_quick_view(){ $('.zoo-mask-close').removeClass('loading active mask-quick-view'); $('#zoo-quickview-lb').css({'top': 'calc(50% + 150px)', 'opacity': '0'}); setTimeout(function (){ $('#zoo-quickview-lb').remove(); }, 500) } function zoo_quick_view_gal(){ if($('.zoo-product-quick-view .wrap-main-product-gallery')[0]){ let thumb_num=$('.zoo-product-gallery.images').data('columns'); $('.zoo-product-quick-view .wrap-main-product-gallery').slick({ slidesToShow: 1, rows: 0, slidesToScroll: 1, focusOnSelect: true, rtl: $('body.rtl')[0] ? true:false, asNavFor: $('.wrap-list-thumbnail')[0] ? '.zoo-product-quick-view .wrap-list-thumbnail':'', prevArrow: '', nextArrow: '', }); $('.zoo-product-quick-view .wrap-list-thumbnail').slick({ slidesToShow: thumb_num, rows: 0, slidesToScroll: 1, focusOnSelect: true, rtl: $('body.rtl')[0] ? true:false, asNavFor: '.zoo-product-quick-view .wrap-main-product-gallery', prevArrow: '', nextArrow: '', }); }} function normally_url_cart(url, parameterName, parameterValue, atStart){ var replaceDuplicates=true; var urlhash=''; var cl=url.length; if(url.indexOf('#') > 0){ cl=url.indexOf('#'); urlhash=url.substring(url.indexOf('#'), url.length); } var sourceUrl=url.substring(0, cl); var urlParts=sourceUrl.split("?"); var newQueryString=""; if(urlParts.length > 1){ var parameters=urlParts[1].split("&"); for (var i=0; (i < parameters.length); i++){ var parameterParts=parameters[i].split("="); if(!(replaceDuplicates&¶meterParts[0]==parameterName)){ if(newQueryString=="") newQueryString="?"; else newQueryString +="&"; newQueryString +=parameterParts[0] + "=" + (parameterParts[1] ? parameterParts[1]:''); }} } if(newQueryString=="") newQueryString="?"; if(atStart){ newQueryString='?' + parameterName + "=" + parameterValue + (newQueryString.length > 1 ? '&' + newQueryString.substring(1):''); }else{ if(newQueryString!==""&&newQueryString!='?') newQueryString +="&"; newQueryString +=parameterName + "=" + (parameterValue ? parameterValue:''); } return urlParts[0] + newQueryString + urlhash; }}) })(jQuery); (function ($){ 'use strict'; $(document).ready(function (){ $(document).on('click', '.zoo-sidebar-control', function (e){ e.preventDefault(); $(this).toggleClass('active'); $('.product-sidebar').toggleClass('active'); if(!$(this).closest('.top-sidebar-layout')[0]||$(window).width() < 992){ $('.zoo-mask-close').addClass('sidebar-active active'); } if($(this).closest('.top-sidebar-layout')[0]&&$(window).width() > 992){ $('.zoo-top-sidebar.product-sidebar').slideToggle("slow"); }}); $(document).on('click', '.sidebar-active.active, .close-btn.close-sidebar', function (e){ e.preventDefault(); $('.product-sidebar, .zoo-sidebar-control').removeClass('active'); $('.zoo-mask-close').removeClass('sidebar-active active'); }); $(document).on('click', '.heading-toggle-block', function (){ $(this).zoo_toggleBlock(); }); $(document).on('click', '.toggle-products-layout-button:not(.active)', function (e){ e.preventDefault(); $('.toggle-products-layout-button.active').removeClass('active'); $(this).addClass('active'); if($(this).data('layout')=='list'){ setCookie('zoo_product_layout', 'list'); $('.zoo-products-shop-loop .products').addClass('list-layout'); $('.zoo-products-shop-loop .products').removeClass('grid-layout'); }else{ deleteCookie('zoo_product_layout'); $('.zoo-products-shop-loop .products').removeClass('list-layout'); $('.zoo-products-shop-loop .products').addClass('grid-layout'); }}); $(document).on('click', '.woocommerce-review-link', function (e){ if($('.zoo-product-data-tabs.accordion-layout')[0]){ if($('#tab-reviews').closest('.zoo-group-accordion:not(.accordion-active)')[0]){ $('.zoo-group-accordion.accordion-active .wc-tab').hide(); } $('#tab-reviews').closest('.zoo-group-accordion:not(.accordion-active)').find('.tab-heading').trigger('click'); $('html, body').animate({ scrollTop: $('#tab-reviews').offset().top - $('.site-header').height() }, 500); }}); $(document).zoo_CartQuantity('.quantity .qty-nav'); zoo_product_sticky_layout(); zoo_product_gallery(); zoo_gallery_light_box(); zoo_product_tabs_block(); zoo_products_carousel(); zoo_product_variable(); zoo_alternate_image(); zoo_toggle_myacount_form(); zoo_add_coupon_cart(); zoo_sticky_add_to_cart(); zoo_cleverswatches_function(); zoo_countdown_end_day(); zoo_extend_cart_info(); zoo_call_back_countdown(); }); function zoo_call_back_countdown(){ $(window).on('load',function(){ var $this=$('.variations_form [data-countdown="countdown"]'); if($this[0]){ var $date=$this.data('date').split("-"); $this.lofCountDown({ TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5], DisplayFormat:"
%%D%% Days
%%H%% Hours
%%M%% Mins
%%S%% Secs
", FinishMessage: "Expired" }); }}); $(document).on("show_variation",".variations_form:not(.cw-form-data)",function (){ var $this=$('.variations_form [data-countdown="countdown"]'); if($this[0]){ var $date=$this.data('date').split("-"); $this.lofCountDown({ TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5], DisplayFormat:"
%%D%% Days
%%H%% Hours
%%M%% Mins
%%S%% Secs
", FinishMessage: "Expired" }); }}); } $(document).on('updated_checkout updated_cart_totals zoo_single_product_cart_added added_to_cart wc_fragment_refresh', function (){ setTimeout(function (){ $('.lazy-img').zoo_lazyImg(); }, 100); }); $(document).on('zoo_ln_after_filter', function (event, response){ $('.grid-layout.products').zoo_WooSmartLayout(); setTimeout(function (){ $('.product-sidebar, .zoo-sidebar-control').removeClass('active'); $('.zoo-mask-close').removeClass('sidebar-active active'); }, 100); setTimeout(function (){ if(typeof $.fn.isotope!='undefined') $('.grid-layout.products.highlight-featured').isotope('reloadItems'); }, 350); if($(window).width() > 992){ $('.zoo-top-sidebar.product-sidebar').slideToggle("slow"); }else{ $('html, body').animate({ scrollTop: $('.zoo-products-shop-loop .products').offset().top }, 500); }}); $(window).load(function (){ $('.products.highlight-featured .product.featured img').attr('sizes', ''); var current_width=0; $(window).resize(function (){ if(current_width!=$(window).width()){ current_width=$(window).width(); setTimeout(function (){ $('.grid-layout.products').zoo_WooSmartLayout(); $('.cvca-products-wrap.advanced-filter .grid-layout.products').zoo_WooSmartLayout(); }, 300); if($(window).width() < 769){ let this_to_top=0; $('#site-header .sticker:visible').each(function (){ if(!!$(this).data('sticky-height')){ this_to_top=$(this).data('sticky-height') + this_to_top; }else{ this_to_top=$(this).height() + this_to_top; }}); $('.wrap-top-shop-loop').stick_in_parent({ bottoming: false, sticky_class: 'is-sticky', offset_top: this_to_top }); }else{ $('.wrap-top-shop-loop').trigger("sticky_kit:detach"); }} }).resize(); zoo_product_360_view(); }); $(window).on('resize', function (){ if($(window).width() > 769){ if($('.sticky.zoo-single-product')[0]||$('.images-center.zoo-single-product')[0]){ var offset=0; if($('#site-header .sticky-wrapper')[0]){ offset=$('#site-header .sticky-wrapper').height() + 30; } $('.wrap-right-single-product').stick_in_parent({offset_top: offset}); $('.images-center.zoo-single-product .zoo-woo-tabs.zoo-accordion').stick_in_parent(); }} }).resize(); function setCookie(cname, cvalue){ document.cookie=cname + "=" + cvalue + "; "; } function deleteCookie(cname){ var d=new Date(); d.setTime(d.getTime() - (1000 * 60 * 60 * 24)); var expires="expires=" + d.toGMTString(); window.document.cookie=cname + "=" + "; " + expires; } function getCookie(cname){ var name=cname + "="; var ca=document.cookie.split(';'); for (var i=0; i < ca.length; i++){ var c=ca[i]; while (c.charAt(0)==' '){ c=c.substring(1); } if(c.indexOf(name)==0){ return c.substring(name.length, c.length); }} return ""; } function zoo_cleverswatches_function(){ $(document).on('cleverswatch_button_select_option', function (event, response){ var add_to_cart_button=response.selector; add_to_cart_button.closest('.variations_form').find('.zoo-buy-now').addClass('disabled'); }); $(document).on('cleverswatch_button_add_cart', function (event, response){ var add_to_cart_button=response.selector; add_to_cart_button.closest('.variations_form').find('.zoo-buy-now').removeClass('disabled'); }); $(document).on('cleverswatch_button_out_stock', function (event, response){ var add_to_cart_button=response.selector; add_to_cart_button.closest('.variations_form').find('.zoo-buy-now').addClass('disabled'); }); $(document).on('cleverswatch_update_gallery', function (event, response){ if(!$('#zoo-quickview-lb')[0]){ zoo_product_gallery(); } var $this=$('.variations_form [data-countdown="countdown"]'); if($this[0]){ var $date=$this.data('date').split("-"); $this.lofCountDown({ TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5], DisplayFormat:"
%%D%% Days
%%H%% Hours
%%M%% Mins
%%S%% Secs
", FinishMessage: "Expired" }); }}); $(window).resize(function (){ if($(window).width() > 769&&$('.zoo-cw-is-desktop')[0]){ $(document).on('mouseenter mouseleave click', '.variations_form .zoo-cw-attribute-option', function(){ var $this=$('.variations_form [data-countdown="countdown"]'); if($this[0]){ var $date=$this.data('date').split("-"); $this.lofCountDown({ TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5], DisplayFormat:"
%%D%% Days
%%H%% Hours
%%M%% Mins
%%S%% Secs
", FinishMessage: "Expired" }); }}); }}).resize(); } function zoo_product_sticky_layout(){ $(window).load(function (){ if(typeof $.fn.stick_in_parent!='undefined'){ var window_width=''; $(window).resize(function (){ if(window_width!=$(window).width()){ window_width=$(window).width(); let $stick_content=$('.sticky-content-layout .wrap-single-product-images, .sticky-content-layout .product .wrap-sticky-content-block>.summary'); if(window_width > 992){ $stick_content.stick_in_parent({offset_top: $('.site-header').height()}); }else{ $stick_content.trigger('sticky_kit:detach'); }} }).resize(); }}); } function zoo_product_variable(){ var orginal_image=''; var orginal_large_image=''; $('.zoo-product-gallery .slick-current').addClass('orginal_active'); jQuery(document).on("show_variation", "form.variations_form", function (event, variation){ if(!$('.zoo-cw-page')[0]){ orginal_image=$('.wrap-main-product-gallery .slick-current img').attr('src'); orginal_large_image=$('.wrap-main-product-gallery .slick-current img').data('src'); if(variation.image.full_src!=''){ var newimg=variation.image.src; var newurl=variation.image.url; zoo_product_variable_gallery(newimg,newurl); }} }); jQuery(".reset_variations").on("click", function (event){ if(!$('.zoo-cw-page')[0]){ event.preventDefault(); zoo_product_variable_gallery(orginal_image,orginal_large_image); }else{ return; }}); } function zoo_product_variable_gallery(orginal_image,orginal_large_image){ $('.zoo-product-gallery .slick-current img:not(.zoomImg)').attr('src', orginal_image); $('.zoo-product-gallery .slick-current img:not(.zoomImg)').attr('data-src', orginal_image); $('.zoo-product-gallery .slick-current img.zoomImg').attr('src', orginal_large_image); $('.zoo-product-gallery .slick-current img:not(.zoomImg)').attr('srcset', orginal_image); $('.zoo-product-gallery .slick-current a').attr('href', orginal_large_image); if(typeof $.fn.zoom!='undefined'){ $('.wrap-main-product-gallery .woocommerce-product-gallery__image a').trigger('zoom.destroy'); if($(window).width() > 768){ $('.wrap-main-product-gallery .woocommerce-product-gallery__image a').zoom(); }} } function zoo_products_carousel(){ $('.products.carousel').each(function (){ let data=$(this).data('zoo-config'); if(!!data){ let cols=data.cols; $(this).slick({ slidesToShow: cols, slidesToScroll: 1, rows: 0, rtl: $('body.rtl')[0] ? true:false, swipe: true, prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 768, settings: { slidesToShow: cols > 3 ? 3:cols }}, { breakpoint: 576, settings: { slidesToShow: cols > 2 ? 2:cols }} ] }) }}) } function zoo_product_tabs_block(){ $('.zoo-product-data-tabs .accordion-active .wc-tab').show(); $(document).on('click', '.tabs li a', function (){ $('.zoo-group-accordion.accordion-active').removeClass('accordion-active'); $($(this).attr('href')).closest('.zoo-group-accordion').addClass('accordion-active'); }); $(document).on('click', '.zoo-group-accordion .tab-heading', function (){ let tab_is_activated=$(this).closest('.accordion-active')[0]; $('.zoo-product-data-tabs .accordion-active .wc-tab').slideUp(); $('.zoo-product-data-tabs .accordion-active').removeClass('accordion-active'); if(!tab_is_activated){ $(this).closest('.zoo-group-accordion').toggleClass('accordion-active'); $(this).next('.wc-tab').slideToggle(); if($('.zoo-product-data-tabs .tabs.wc-tabs')[0]){ let id=$(this).next('.wc-tab').attr('id'); $('.zoo-product-data-tabs .tabs.wc-tabs .active').removeClass('active'); $('.zoo-product-data-tabs .tabs.wc-tabs a[href="#' + id + '"]').parent().addClass('active'); }} }); } function zoo_product_gallery(){ if(typeof $.fn.slick!='undefined'){ let thumb_num=$('.zoo-product-gallery.images').data('columns'); var gallery_layout=$('.zoo-product-gallery.images').data('layout'); let ath=true; ath=gallery_layout=='slider' ? false:true; var window_width=''; $(window).resize(function (){ if(window_width!=$(window).width()){ if($('.zoo-product-gallery:not(.none-slider) .wrap-main-product-gallery:not(.slick-slider)')[0]){ $('.zoo-product-gallery:not(.none-slider) .wrap-main-product-gallery').slick({ slidesToShow: 1, slidesToScroll: 1, rows: 0, rtl: $('body.rtl')[0] ? true:false, swipe: true, adaptiveHeight: ath, asNavFor: $('.wrap-list-thumbnail')[0] ? '.zoo-product-gallery .wrap-list-thumbnail':'', prevArrow: '', nextArrow: '', }); } $('.zoo-product-gallery:not(.none-slider) .wrap-list-thumbnail.slick-slider').slick('unslick'); if($(window).width() > 576){ $('.zoo-product-gallery:not(.none-slider) .wrap-list-thumbnail:not(.slick-slider)').slick({ slidesToShow: thumb_num, rows: 0, slidesToScroll: 1, vertical: $('.zoo-product-gallery.vertical-gallery')[0] ? true:false, verticalSwiping: $('.zoo-product-gallery.vertical-gallery')[0] ? true:false, focusOnSelect: true, adaptiveHeight: ath, rtl: $('body.rtl')[0] ? true:false, asNavFor: '.zoo-product-gallery .wrap-main-product-gallery', prevArrow: $('.zoo-product-gallery.vertical-gallery')[0] ? '':'', nextArrow: $('.zoo-product-gallery.vertical-gallery')[0] ? '':'', }); }else{ $('.zoo-product-gallery:not(.none-slider) .wrap-list-thumbnail:not(.slick-slider)').slick({ slidesToShow: thumb_num, rows: 0, slidesToScroll: 1, focusOnSelect: true, adaptiveHeight: ath, rtl: $('body.rtl')[0] ? true:false, asNavFor: '.zoo-product-gallery .wrap-main-product-gallery', prevArrow: '', nextArrow: '', }); } if($(window).width() > 992){ if($('.zoo-product-gallery.none-slider .wrap-main-product-gallery.slick-initialized')[0]){ $('.zoo-product-gallery.none-slider .wrap-main-product-gallery.slick-initialized').slick('unslick'); $('.zoo-product-gallery.none-slider .wrap-list-thumbnail.slick-initialized').slick('unslick'); }}else{ $('.zoo-product-gallery.none-slider .wrap-main-product-gallery:not(.slick-slider)').slick({ slidesToShow: 1, slidesToScroll: 1, rows: 0, adaptiveHeight: ath, rtl: $('body.rtl')[0] ? true:false, swipe: true, asNavFor: $('.wrap-list-thumbnail')[0] ? '.zoo-product-gallery.none-slider .wrap-list-thumbnail':'', prevArrow: '', nextArrow: '', }); $('.zoo-product-gallery.none-slider .wrap-list-thumbnail:not(.slick-slider)').slick({ slidesToShow: thumb_num, rows: 0, slidesToScroll: 1, focusOnSelect: true, adaptiveHeight: ath, rtl: $('body.rtl')[0] ? true:false, asNavFor: '.zoo-product-gallery.none-slider .wrap-main-product-gallery', prevArrow: '', nextArrow: '', }); } window_width=$(window).width(); }}).resize(); $(document).on('click', '.wrap-list-thumbnail a', function (e){ e.preventDefault(); }); $('.zoo-product-gallery.slider-gallery .wrap-main-product-gallery').slick('slickSetOption', 'slidesToShow', thumb_num, false); let responsive=[{breakpoint: 768, settings: {slidesToShow: 2}}, { breakpoint: 576, settings: {slidesToShow: 1}}]; $('.zoo-product-gallery.slider-gallery .wrap-main-product-gallery').slick('slickSetOption', 'responsive', responsive, true); } var w_width=''; $(window).resize(function (){ if(w_width!=$(window).width()){ if(typeof $.fn.zoom!='undefined'){ $('.wrap-main-product-gallery .woocommerce-product-gallery__image a').trigger('zoom.destroy'); if($(window).width() > 768){ $('.wrap-main-product-gallery .woocommerce-product-gallery__image a').zoom(); }} w_width=$(window).width(); }}).resize(); } function zoo_gallery_light_box(){ $(document).on('click', '.wrap-main-product-gallery .woocommerce-product-gallery__image a', function (e){ e.preventDefault(); if(typeof PhotoSwipe!='undefined'){ var pswpElement=$('.pswp')[0], items=$(this).zooGetGalleryItems(), c_index=$(this).parent().index(); if($(this).closest('.slick-slide')[0]){ if($('.carousel.zoo-single-product')[0]){ var total_sl_active=$('.wrap-single-image .slick-active').length; if(total_sl_active==0){ c_index=$(this).closest('.slick-slide').index(); }else{ c_index=$(this).closest('.slick-slide').index() - total_sl_active - 1; }}else{ c_index=$(this).closest('.slick-slide').index() - 1; }} var options={ index: c_index, shareEl: false, closeOnScroll: false, history: false, hideAnimationDuration: 0, showAnimationDuration: 0 }; var photoswipe=new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); photoswipe.init(); }}); } function zoo_alternate_image(){ $(document).on('hover', '.products .product', function (){ let $this=$(this).find('.sec-img'); if(!!$this.data('src')&&$this.attr('src')!=$this.data('src')){ $this.attr('src', $this.data('src')); $this.attr('srcset', $this.data('srcset')); }}); } function zoo_toggle_myacount_form(){ $(document).on('click', '.toggle-register-form, .toggle-form-button.toggle-register', function (e){ e.preventDefault(); $('#customer_login .u-column2').slideDown(); $('#customer_login .u-column1').slideUp(); $('.toggle-form-block-register').slideUp(); $('.toggle-form-block-login').slideDown(); }); $(document).on('click', '.toggle-login-form, .toggle-form-button.toggle-login', function (e){ e.preventDefault(); $('#customer_login .u-column2').slideUp(); $('#customer_login .u-column1').slideDown(); $('.toggle-form-block-register').slideDown(); $('.toggle-form-block-login').slideUp(); }); } function zoo_add_coupon_cart(){ $(document).on('click', '.content-toggle-block .button.apply-coupon', function (){ $('.woocommerce-cart-form #coupon_code').attr('value', $('.content-toggle-block input[name*=coupon_code]').val()); $('.woocommerce-cart-form .button[name*=apply_coupon]').trigger('click'); }); } function zoo_sticky_add_to_cart(){ $(window).load(function (){ if($('.zoo-sticky-add-to-cart')[0]&&$('.summary form.cart')[0]){ jQuery(window).on("scroll", function (){ if($(window).scrollTop() > $('.summary form.cart').height() + $('.summary form.cart').offset().top&&$(window).scrollTop() + $(window).height() < $('footer.site-footer').offset().top){ $('.zoo-sticky-add-to-cart:not(.active)').addClass('active') }else{ $('.zoo-sticky-add-to-cart.active').removeClass('active') }}); $(document).on('click', '.zoo-sticky-add-to-cart .button-sticky-add-to-cart', function (e){ e.preventDefault(); $('html, body').animate({ scrollTop: $('.summary').offset().top }, 700); }); }}); } function zoo_product_360_view(){ if($('.product-image-360-view')[0]){ let $wrap=$('.product-image-360-view .zoo-wrap-img-360-view'); let width=$wrap.find('.zoo-wrap-content-view').width(); let height=$wrap.find('.zoo-wrap-content-view').height(); if(parseInt(width) > $wrap.find('.zoo-wrap-content-view').width()){ let res=parseInt(width / height); width=$(this).find('.zoo-wrap-img-360-view').width(); height=parseInt(parseInt(width) / res); } $(document).on('click', '.product-360-view-control', function (){ $('.product-image-360-view, .product-extended-button').toggleClass('active'); }); $(document).on('click', '.mask-product-360-view', function (){ $('.product-image-360-view, .product-extended-button').removeClass('active'); }); $wrap.find('.zoo-wrap-content-view').spritespin({ source: $('.product-image-360-view').attr('data-zoo-config').split(','), width: width, height: height, animate: false }); var api=$wrap.find('.zoo-wrap-content-view').spritespin("api"); $wrap.find('.zoo-control-view:not(.zoo-center)').on('click', function (){ if($wrap.hasClass('zoo-prev-item')){ api.prevFrame(); }else{ api.nextFrame(); }}); }} function zoo_countdown_end_day(){ if($('.zoo-get-order-notice .end-of-day')[0]){ var offset=$('.end-of-day').data('timezone'); var day=new Date(); var utc=day.getTime() + (day.getTimezoneOffset() * 60000); let d=new Date(utc + (3600000*offset)), duration=60 * (60 - d.getMinutes()); let timer=duration, minutes; let hours=(23 - d.getHours()); hours=hours < 10 ? '0' + hours:hours; let label_h=$('.zoo-get-order-notice .end-of-day').data('hours'); let label_m=$('.zoo-get-order-notice .end-of-day').data('minutes'); setInterval(function (){ minutes=parseInt(timer / 60, 10); minutes=minutes < 10 ? "0" + minutes:minutes; $('.zoo-get-order-notice .end-of-day').text(hours + ' ' + label_h + ' ' + minutes + ' ' + label_m); if(--timer < 0){ timer=duration; }}, 1000); }} function zoo_extend_cart_info(){ if($('.summary>.product_title').text()!=''){ $('.content-popup-page .wpcf7-hidden[name="product"]').val($('.summary>.product_title').text()); } $(document).on('click', '.zoo-extend-cart-info-item >a', function (e){ e.preventDefault(); $('.wrap-content-popup-page').addClass('active'); $('.close-zoo-extend-cart-info').addClass('active'); $('.' + $(this).data('target')).addClass('active'); }); $(document).on('click', '.close-zoo-extend-cart-info, .wrap-content-popup-page .close-popup-page', function (){ $('.wrap-content-popup-page.active').removeClass('active'); $('.close-zoo-extend-cart-info.active').removeClass('active'); $('.content-popup-page.active').removeClass('active'); }); } jQuery.fn.extend({ zoo_WooSmartLayout: function (default_cols){ if(jQuery(this)[0]){ jQuery(this).each(function (){ if(!!$(this).data('zoo-config')){ var $this=$(this); var data, cols, table_cols, mobile_cols, active_featured, wrap_width, res, product_width, img_w; data=$this.data('zoo-config'); cols=parseInt(data.cols); active_featured=parseInt(!!data.highlight_featured ? data.highlight_featured:0); if(!!cols&&!!active_featured){ wrap_width=Math.floor($this.width()); if(!!default_cols){ cols=default_cols; }else{ table_cols=parseInt(!!data.tablet ? data.tablet:2); mobile_cols=parseInt(!!data.mobile ? data.mobile:1); if($(window).width() <=577){ cols=mobile_cols; }else if($(window).width() < 993&&$(window).width() > 577){ cols=table_cols; }} product_width=Math.floor(wrap_width / cols); if(cols > 1){ $this.find('.product.featured').outerWidth(product_width * 2); $this.find('.product:not(.featured)').outerWidth(product_width); } setTimeout(function (){ if(cols > 1){ var height=0; $this.find('.product:not(.featured)').each(function (){ if($(this).outerHeight(true) > height){ height=$(this).outerHeight(true); }}); $this.find('.product:not(.featured)').outerHeight(height); if($(window).width() > 768){ $this.find('.product.featured').outerHeight(height * 2); }else{ $this.find('.product.featured').outerHeight('auto'); } $this.isotope({ layoutMode: 'masonry', itemSelector: '.product', percentPosition: true, masonry: { columnWidth: '.product:not(.featured)' }}); }}, 700); }} }); }}, zoo_toggleBlock: function (){ $(this).next('.content-toggle-block').slideToggle(); }, zoo_CartQuantity: function (target){ if($(this)[0]){ $(this).on("click", target, function (){ let qty=jQuery(this).parents('.quantity').find('input.qty'); let val=parseInt(qty.val()); if($(this).hasClass('increase')){ qty.val(val + 1); }else{ if($(this).closest('.woocommerce-grouped-product-list')[0]){ if(val > 0){ qty.val(val - 1); }}else{ if(val > 1){ qty.val(val - 1); }} } qty.trigger('change'); }); }}, zooGetGalleryItems: function (){ var $slides, items=[]; if($('.zoo-product-gallery.none-slider')[0]){ $slides=this.parents('.wrap-main-product-gallery').find('.woocommerce-product-gallery__image'); }else{ $slides=this.parents('.wrap-main-product-gallery').find('.slick-slide:not(.slick-cloned)'); } if($slides.length > 0){ $slides.each(function (i, el){ var img=$(el).find('img'), large_image_src=img.attr('data-large_image'), large_image_w=img.attr('data-large_image_width'), large_image_h=img.attr('data-large_image_height'), item={ src: large_image_src, w: large_image_w, h: large_image_h, title: img.attr('title') }; items.push(item); }); } return items; }}); }) (jQuery); (function ($){ 'use strict'; jQuery(document).ready(function ($){ MediaFullWidth($('.media-block iframe')); zoo_comment_form_field(); zoo_back_to_top(); function zoo_fix_vc_full_width_row(){ var $elements=jQuery('[data-vc-full-width="true"]'); jQuery.each($elements, function (){ var $el=jQuery(this); $el.css('right', $el.css('left')).css('left', ''); }); } jQuery(document).on('vc-full-width-row', function (){ if($('body.rtl')[0]){ zoo_fix_vc_full_width_row(); }}); zoo_fix_vc_full_width_row(); var current_width=0; $(window).resize(function (){ if(current_width!=$(window).width()){ current_width=$(window).width(); $('.single .post-detail iframe, .wp-block-embed__wrapper iframe').each(function (){ let width,height; width=!!$(this).attr('width')?$(this).attr('width'):$(this).width(); height=!!$(this).attr('height')?$(this).attr('height'):$(this).height(); let ration=height / width; let wrap_width=$(this).parent().width(); $(this).width(wrap_width); $(this).height(wrap_width * ration); }) }}).resize(); if(typeof $.fn.slick!='undefined'){ $('.post-slider').slick({ slidesToShow: 1, slidesToScroll: 1, rows: 0, rtl: $('body.rtl')[0] ? true:false, swipe: true, centerPadding: '120px', prevArrow: '', nextArrow: '', centerMode: true, responsive: [ { breakpoint: 768, settings: { centerPadding: '40px', }}, { breakpoint: 480, settings: { arrows: false, centerPadding: '0', }} ] }); } if($('.widget_categories, .widget_nav_menu, .widget_pages')[0]){ $('.widget_categories, .widget_nav_menu, .widget_pages').each(function (){ $(this).find('.children, .sub-menu').parent().append(''); }); $(document).on('click', 'span.toggle-view', function (){ $(this).toggleClass('active'); $(this).parent().find(' > .children').slideToggle(); $(this).parent().find('>.sub-menu').slideToggle(); }); } if(zooThemeSettings.enable_dev_mode==='1'){ var $body=$(document.body), queryMark=null, currentUrl=window.location.href.replace(/[&|\?]text-direction=\S{3}/g, ''); if(!$('#zoo-theme-dev-actions').length){ $body.append('
'); } if(currentUrl.indexOf('?') > -1){ queryMark='&'; }else{ queryMark='?'; } if(zooThemeSettings.isRtl||$body.hasClass('rtl')){ $('#zoo-theme-dev-actions').append('LTR'); }else{ $('#zoo-theme-dev-actions').append('RTL'); }} }); function zoo_comment_form_field(){ $(document).on('focusin', '.wrap-text-field input, .wrap-text-field textarea', function (){ $(this).parents('.wrap-text-field').addClass('focus'); }); $(document).on('focusout', '.wrap-text-field input, .wrap-text-field textarea', function (){ if($(this).val()=='') $(this).parents('.wrap-text-field').removeClass('focus'); }); $('.wrap-text-field input, .wrap-text-field textarea').each(function (){ if($(this).val()!='') $(this).parents('.wrap-text-field').addClass('focus'); }); } $(window).on('load', function (){ $('#page-load').addClass('deactive'); $('.lazy-img').zoo_lazyImg(); }); jQuery.fn.extend({ zoo_lazyImg: function (){ if($(this)[0]){ $(this).not('.sec-img, .loaded').parent().addClass('loading'); if(typeof deferimg!="undefined"){ deferimg(this.selector+':not(.sec-img)', 0, 'loaded', function (){ $(this).closest('.loading').removeClass('loading'); }); }} }, ActiveScreen: function (){ var itemtop, windowH, scrolltop; itemtop=$(this).offset().top; windowH=$(window).height(); scrolltop=$(window).scrollTop(); if(itemtop < scrolltop + windowH * 2 / 3){ return true; }else{ return false; }}, }); var MediaFullWidth=function (selector){ var current_width=0; $(window).resize(function (){ if(current_width!=$(window).width()){ current_width=$(window).width(); selector.each(function (){ let aspectRatio=$(this).height() / $(this).width(); $(this).removeAttr('height').removeAttr('width'); let newWidth=jQuery(this).parent().width(); $(this).width(newWidth).height(newWidth * aspectRatio); }); }}).resize(); }; function zoo_back_to_top(){ $(window).load(function (){ if($('#zoo-back-to-top')[0]){ let $toTopButton=$('#zoo-back-to-top'); jQuery(window).on("scroll", function (){ if($(window).scrollTop() > 100){ $toTopButton.addClass('active') }else{ $toTopButton.removeClass('active') }}); $(document).on('click', '#zoo-back-to-top', function (e){ e.preventDefault(); $('html, body').animate({ scrollTop: 0 }, 700); }); }}); } $(document).on('click', '.cvca-button', function (e){ let target=$(this).attr('href'); if($(target)[0]){ e.preventDefault(); $('html, body').animate({ scrollTop: $(target).offset().top - $('.site-header').height() / 2 }, 800); }}); })(jQuery);